﻿Public Partial Class OpenPicnik
    Inherits System.Web.UI.Page

    Private imgUrl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim apikey As String = System.Configuration.ConfigurationManager.AppSettings("PicnikKey")
        imgUrl = Request.Params("imgUrl")
        If String.IsNullOrEmpty(imgUrl) Then
            Response.Write("No URL found.") : Exit Sub
        ElseIf String.IsNullOrEmpty(apikey) Then
            Response.Write("You must set PicnikKey in web.config for this functionality.") : Exit Sub
        End If

        imgUrl = "http://www.picnik.com/service/?_apikey=" & apikey & _
           "&_import=" & Uri.EscapeDataString(imgUrl)

        Response.Clear()
        Response.AppendHeader("Refresh", "0; url=" & imgUrl)
        Response.Write(String.Format("Loading <a href=""{0}"">PicNik</a>...", imgUrl))

        ' Response.Write("Loading <a href=""" & url & ">Picnik</a>....")
        ' Me.HyperLink1.NavigateUrl = url

    End Sub


End Class